<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- 报表统计页面 -->
<section data-v-16d172c6="" class="main-content reportStatistics view">
	<div data-v-5c0470a4="" class="notice">
		<div data-v-5c0470a4="" class="brown-circle">!</div>盈利总额：投注总额  <i style="font-size: 12px;padding: 0 5px;" class="iconfont icon-subtraction"></i>派奖总额</div>
		
	<div data-v-16d172c6="" class="search "><span data-v-16d172c6="">时间：</span>
		<select data-v-16d172c6="" class="select select-tduibiaob-date">
			<option data-v-16d172c6="" value="">今天</option>
			<option data-v-16d172c6="" value="1">
				昨天
			</option>
			<option data-v-16d172c6="" value="3">
				一周
			</option>
			<option data-v-16d172c6="" value="4">
				半个月
			</option>
		</select><span data-v-16d172c6="">日期：</span>
		<div data-v-16d172c6="" class="ivu-date-picker">
			<div class="ivu-date-picker-rel">
				<div class="ivu-input-wrapper ivu-input-type ivu-date-picker-editor">
					<input type="text" id="date1" placeholder="开始时间" value="" lay-key="" class="ivu-input layer-date" readonly="readonly">
					<span style="margin: 0 10px;">至</span>
					<input type="text" id="date2" placeholder="结束时间" value="" lay-key="" class="ivu-input layer-date" readonly="readonly">		
				</div>
			</div>
			<div class="ivu-select-dropdown" style="display: none;">
				<div></div>
			</div>
		</div> <button data-v-16d172c6="" class="button demand button-cx-tdbb">查询</button></div>
		<table data-v-16d172c6="" class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover " id="report"><!-- table  -->
			<thead data-v-16d172c6="">
				<tr data-v-16d172c6="">
					<th data-v-16d172c6="" >盈利总额</th>
					<th data-v-16d172c6="" >有效投注总额</th>
					<th data-v-16d172c6="" >派奖总额</th>
					<th data-v-16d172c6="" >充值金额</th>
					<th data-v-16d172c6="" >提款总额</th>
				</tr>
			</thead>
			<tbody class='thead-tj'>
				<td class='th-ylze-cx'></td>
				<td class='th-yxtzze-cx'></td>
				<td class='th-pjze-cx'></td>
				<td class='th-czje-cx'></td>
				<td class='th-tklx-cx'></td>
			</tbody>
		</table>
</section>
<script type="text/javascript">
layui.use('laydate', function() { //layui时间插件
	 laydate= layui.laydate;
	laydate.render({
		elem: '#date1'
	});
	laydate.render({
		elem: '#date2'
	});
});

//点击选择日期类型查询
function baobiao() {
	$.ajax({
		type: "post",
		url: "/agent/findAllTeamRcord.do",
		data: {
			"startDate": StartDate,
			"endDate": EndDate
		},
		success: function(data) {
			var newData = data.data;
			var touzhu= $(".thead-tj .th-yxtzze-cx").text(newData.cptouzhu+"元");
			var paijiang=$(".thead-tj .th-pjze-cx").text(newData.cppaijiang+"元");
			var chongzhi=$(".thead-tj .th-czje-cx").text(newData.zxchongzhi+"元");
			var tikuan=$(".thead-tj .th-tklx-cx").text(newData.zxtikuan+"元");
			var yingli=$(".thead-tj .th-ylze-cx").text(newData.bd_money+"元");
		}
	});
}

//点击选择日期类型查询
$(".div-dl-date").on("click", function() {
	if($(this).next().hasClass("active")) {
		$(this).next().removeClass("active")
	} else {
		$(this).next().addClass("active")
	}
})

var s1 = GetDateStr(0);
$("#date1").val(s1);
$("#date2").val(s1);
var StartDate = $("#date1").val();
var EndDate = $("#date2").val();

$(".button-cx-tdbb").on("click", function() {
	StartDate = $("#date1").val();
	EndDate = $("#date2").val();
	if(Number(StartDate.replace(/-/g, "")) > Number(EndDate.replace(/-/g, ""))) {
		bindLayerLittle("提示：", "开始时间不能大于结束时间")
	} else {
		baobiao()
	}
})

$(".search .select-tduibiaob-date").on("click", function() {
	function trimStr(str) {
		var re = /^\s+|\s+$/g; // |代表或者 \s代表空格  +至少一个 前面有至少一个空格 或者后面有至少一个空格 且全局匹配
		return str.replace(re, ''); //把空格替换成空
	}
	var str = trimStr($('.select-tduibiaob-date option:selected').text());
	if(str == "今天") {
		StartDate = GetDateStr(0)
		EndDate = GetDateStr(0)
	} else if(str == "昨天") {
		StartDate = GetDateStr(1)
		EndDate = GetDateStr(1)
	} else if(str == "一周") {
		StartDate = GetDateStr(7)
		EndDate = GetDateStr(0)
	} else {
		StartDate = GetDateStr(15)
		EndDate = GetDateStr(0)
	}
	$("#date1").val(StartDate);
	$("#date2").val(EndDate);
})
baobiao()
</script>
